import {request} from '@/plugins/axios'
export function getBookList(data) {
  return request({
    url: '/getBookList',
    method: 'get',
    data: data
  })
}
export function returnBook(data) {
  return request({
    url: '/returnBook',
    method: 'get',
    params: {
      borrow_id: data.borrow_id
    }
  })
}
export function borrowBook(data,uid) {
  return request({
    url: '/borrowBook',
    method: 'get',
    params: {
      bid: data.bid,
      uid:uid
    }
  })
}
export function chat(data) {
  return request({
    url: '/ai/chat',
    method: 'get',
    params: {
      message: data
    }
  })
}
export function searchByBook(data) {
  return request({
    url: '/searchByBook',
    method: 'get',
    params: {
      name: data
    }
  })
}
export function submitNewBook(data) {
  return request({
    url: '/submitNewBook',
    method: 'get',
    params: {
      name: data.name,
      author: data.author,
      total_copies: data.total_copies
    }
  })
}
export function login(data) {
  return request({
    url: '/login',
    method: 'get',
    params: {
      uid: data.uid,
      password: data.password
    }
  })
}
export function getBorrowList(data) {
  return request({
    url: '/getBorrowList',
    method: 'get',
    data: data
  })
}
export function getUserList(data) {
  return request({
    url: '/getUserList',
    method: 'get',
    data: data
  })
}
export function changeRole(data) {
  return request({
    url: '/changeRole',
    method: 'get',
    params: {
      uid: data.uid
    }
  })
}
export function addUser(data) {
  return request({
    url: '/addUser',
    method: 'get',
    params: {
      password: data.password,
      role:  data.role
    }
  })
}